package cn.jasonone.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class MyServeltContextListener implements ServletContextListener {

	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		// 关闭数据源
		// 释放资源
		System.out.println("服务器关闭");
	}
	

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		// 初始化数据源
		// 初始化缓存
		// 全局的资源初始化
		System.out.println("服务器启动");
		ServletContext sc = sce.getServletContext();
		System.out.println(sc.getInitParameter("username"));
	}

}
